-- License: CC0

local filename = minetest.get_worldpath() .. "/chatlog.txt"
local date_format = "%d/%m/%y %X"

minetest.register_on_chat_message(function(name, msg)
	local f = io.open(filename, "a")
	f:write(string.format("(%s) [%s]: %s\n", os.date(date_format), name, msg))
	f:close()
end)
